package com.hxs.colorfultest2.service.impl;

import com.hxs.colorfultest2.dao.UserDao;
import com.hxs.colorfultest2.domain.User;
import com.hxs.colorfultest2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao userDao;

    @Override
    public void addUser(User user) {
        userDao.addUser(user);
    }


    /*更新用户权限*/
    @Override
    public void updateUser(User user) {
            userDao.updateUser(user);
    }

    @Override
    public List<User> getAllUser() {
        return userDao.getAllUser();
    }


    /*得到用户总记录数 进行分页计算*/
    @Override
    public int getUserByTotal() {
        return userDao.getUserByTotal();
    }

    /*得到分页用户*/
    @Override
    public List<User> getUserByPage(Map<String, Object> paramMap) {
        return userDao.getUserByPage(paramMap);
    }

    @Override
    /*检验用户名是否重复*/
    public boolean checkName(String name) {
        return userDao.checkName(name);
    }

    /*删除用户*/
    @Override
    public void deleteUser(String username) {
        userDao.deleteUser(username);
    }

    /*根据用户名查找用户*/
    @Override
    public User getUserByName(String username) {
        return userDao.getUserByName(username);
    }
}
